import sys
print(sys.path)

from front_end import auth
from front_end.chat_page import chat_bp
from flask import Flask, render_template, request, redirect, url_for

app = Flask(__name__)
app.register_blueprint(chat_bp)

@app.route('/')
def home():
    return render_template('home.html')  # 显示登录页面

@app.route('/login', methods=['POST'])
def login():
    username = request.form['username']
    password = request.form['password']
    # 假设 auth.verify_user 是认证逻辑
    if auth.verify_user(username, password):
        return redirect(url_for('chat'))
    return "Login failed", 401

@app.route('/chat')
def chat():
    return redirect(url_for('chat_page.chat'))



